import api from '@/common/api.js'
/**
 * 账户密码登录
 * @param {Object} params 登录参数
 */
function accountLogin(params) {
	return new Promise((resolve, reject) => {
		uni.request({
			url: api.HOST + '/temp_login',
			method: 'POST',
			data: params,
			success: (res) => {
				console.log(res);
				if (res.statusCode == 200) {
					console.log("登录成功")
					console.log(res.data)
					resolve(res)
				} else {
					reject('登录失败');
					console.log("登陆失败")
				}
			},
			fail: (err) => {
				console.log(err);
				reject(err)
			}
		})
	})
}

module.exports = {
	login: accountLogin
}
